package com.woniu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniu.pojo.CoursesCard;
import com.woniu.mapper.CoursesCardMapper;
import com.woniu.service.ICoursesCardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.vo.cardVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.LinkedList;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiaohuang
 * @since 2022-10-17
 */
@Service
public class CoursesCardServiceImpl extends ServiceImpl<CoursesCardMapper, CoursesCard> implements ICoursesCardService {
    @Autowired
    private CoursesCardMapper coursesCardMapper;

   /* @Override
    public Integer saveCoursesCard(String id, cardVo[] cardVo) {
        if (cardVo.length == 0){
            return 0;
        }
        QueryWrapper<CoursesCard> wrapper = new QueryWrapper<>();
        wrapper.eq("course_id", id);
        int delete = coursesCardMapper.delete(wrapper);
        CoursesCard coursesCard = new CoursesCard();
        Collection<CoursesCard> coursesCards = new LinkedList<>();
        coursesCard.setCourseId(id);
        for (cardVo vo : cardVo) {
            coursesCard.setCardId(vo.getId());
            int insert = coursesCardMapper.insert(coursesCard);

        }
        return 1;
    }*/
}
